Docker container state and management command from cli
Docker container state and management command from cli#

Created#
Docker assigns the created state to the containers that were never started ever since they were created. NO CPU or memory is used by the containers in this state.
docker create -it --name my_container busybox
Running#
docker start my_container
docker inspect -f '{{.State.Status}}' my_container
#
running
docker run -it --name my_container busybox
docker stop my_container
docker inspect -f '{{.State.Status}}' my_container
#
exited
Pause#
Pause the state of docker container that suspends all the processes in the container A paused container consumes the same memory used while running but no CPU.
docker pause my_container
docker inspect -f '{{.State.Status}}' my_container
#
paused
docker unpause my_container
docker inspect -f '{{.State.Status}}' my_container
#
running
Delete#
docker rm my_container
container resource usage statistics
docker stats --no-stream
commands#
remove all stopped containers#
docker rm $(docker ps -a -q -f status=exited)